Raise PHPStan to level 10 - #1
Merged
Merged
Conversation
Tighten array shapes, generics, and narrowing helpers across src/ so the strictest level passes without baselines, ignores, or @var overrides. Adds phpstan/phpstan-phpunit so assertIsArray-style narrowing flows into reflection-based test helpers (invokeArrayMethod, invokeStringMethod, invokeInstance) used to type private-method probes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
phpstan.neon.distfrom level 8 to level 10 and resolved all 356 resulting errors without@phpstan-ignore, baseline entries, inline@varoverrides, silencing casts, or type widening.src/(85 errors): added@phpstan-typealiases (FeatureMatrixReport, FactSet, etc.), genericWorkerPool::map<TResult>,resourcetyping on worker sockets, and narrowing helpers for unserialized/JSON data in stores and codecs.tests/(271 errors): addedphpstan/phpstan-phpunitso PHPUnit assertions narrow types; introduced typed reflection helpers (invokeArrayMethod,invokeStringMethod,invokeInstance<T>) and reshaped oracle data (ComplianceReport,Scenarioaccessors,OutputNormalizer::asString/asInt).Test plan
composer cs(phpcs)composer analyse(PHPStan level 10, 0 errors)composer test(269 tests, 1591 assertions, all green)ubuntu-latest/ PHP 8.4🤖 Generated with Claude Code